package controllers.security;

import models.usuarios.Usuario;
import controllers.Secure;

public class Security extends Secure.Security {

    static boolean authentify(String username, String password) {
        Usuario user = (Usuario) Usuario.find("byUsername", username).fetch().get(0);
        return user != null && username.equals(password);
    }

    public static Usuario connected() {
        String username = session.get("username");
        System.out.println("--->" + username);
        return (Usuario) Usuario.find("byUsername", username).fetch().get(0);
    }

    public static String recuperarUsernameDelUsuarioConectado() {
        return session.get("username");
    }
}
